package controller;

import java.util.Vector;

import model.Model;
import view.MainView;
import entities.Mesa;
import entities.QueryResult;
import filters.IFilter;

public class Controller implements Runnable {
	private MainView mainView;
	private Model model;

	public void setModules(MainView mv, Model mo) {
		mainView = mv;
		model = mo;
	}

	@Override
	public void run() {
	

	}

	public boolean store(Vector dataVector, String txtNroMesa, boolean selected, String barrio) {
		
		Mesa m = new Mesa(Integer.valueOf(txtNroMesa), selected, barrio);
		for (Object ob : dataVector) {
			Vector<String> aux = (Vector<String>) ob;
			Integer cant = Integer.valueOf (aux.elementAt(1));
			m.addVoto(aux.elementAt(0), cant);
		}
		return model.store(m);
	}
	
	public QueryResult query(IFilter filter){
		return model.query(filter);
	}
}
